package com.weirdor.mongo.exception;

import com.weirdor.mongo.exception.code.BaseErrorCode;

/**
 * @Author werdor
 * @Date 2021/11/9 1:16 下午
 **/
public class BaseClientException extends BaseException {

    private static final long serialVersionUID = 1L;

    /**
     * 用带 {@link BaseErrorCode} 的构造器替代
     *
     * @param message
     */
    @Deprecated
    public BaseClientException(String message) {
        super(message);
    }

    /**
     * 用带 {@link BaseErrorCode} 的构造器替代
     *
     * @param message
     */
    @Deprecated
    public BaseClientException(Throwable throwable) {
        super(throwable);
    }

    /**
     * 用带 {@link BaseErrorCode} 的构造器替代
     *
     * @param message
     */
    @Deprecated
    public BaseClientException(String message, Throwable throwable) {
        super(message, throwable);
    }

    /**
     * 用带 {@link BaseErrorCode} 的构造器替代
     *
     * @param message
     */
    @Deprecated
    public BaseClientException(String message, Throwable throwable, int code) {
        super(message, throwable);
    }

    // ---------------------------------------------------------------------------------

    public BaseClientException(BaseErrorCode errorCode) {
        // 未对参数验证，虽可能存在空指针异常，即使存在也是我们内部问题，下同
        this(errorCode, errorCode.toString());
    }

    public BaseClientException(BaseErrorCode errorCode, String excMsg) {
        super(errorCode, excMsg);
    }

    public BaseClientException(Throwable throwable, BaseErrorCode errorCode) {
        this(throwable, errorCode, errorCode.toString());
    }

    public BaseClientException(Throwable throwable, BaseErrorCode errorCode, String excMsg) {
        super(throwable, errorCode, excMsg);
    }

}

